package qunar.d20210914.t1;

import java.util.Scanner;

class Solution {
    /* Write Code Here */
    public String solution(int[] d) {
        if (d == null || d.length == 0) {
            return "";
        }

        int n = d.length;
        int[] cntMap = new int[10];

        for (int i = 0; i < n; i++) {
            cntMap[d[i]]++;
        }
        StringBuilder sb = new StringBuilder();
        int j, mod;
        for (int i = cntMap.length - 1; i > 0; i--) {
            mod = i % 3;
            if (mod == 0) {
                j = cntMap[i];
                while (j-- > 0) {
                    sb.append(i);
                }
            } else if (mod == 2){

            } else {

            }
        }
        return "";
    }
}

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String res;

        int _d_size = 0;
        _d_size = Integer.parseInt(in.nextLine().trim());
        int[] _d = new int[_d_size];
        int _d_item;
        for(int _d_i = 0; _d_i < _d_size; _d_i++) {
            _d_item = Integer.parseInt(in.nextLine().trim());
            _d[_d_i] = _d_item;
        }

        res = new Solution().solution(_d);
        System.out.println(res);
    }
}

